package com.fish.anne.webapp.filter;

import java.io.IOException;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.filter.OncePerRequestFilter;

public class MemberViewPathFilter extends OncePerRequestFilter {

	private final transient Log log = LogFactory.getLog(MemberViewPathFilter.class);

	public void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {

		String sessionId = request.getSession(true).getId();
		String query = request.getQueryString() != null ? request.getQueryString() : "";
		String url = request.getRequestURL().toString();
		if (url.endsWith("/")) {
			if (!query.equals("")) {
				url = url + query;
			}
		}
		log.info("sessionId\t" + sessionId + "\t" + request.getRemoteHost() + "\trequest\t" + url);

		 

		chain.doFilter(request, response);

	}
}
